//------------Sonic CD Water Splash Script-------------//
//--------Scripted by Christian Whitehead 'The Taxman'--------//
//-------Unpacked By Rubberduckycooly's Script Unpacker-------//

//-------Aliases-------//
#alias 65: TYPE_WATERSPLASH


sub ObjectPlayerInteraction
	if Object.State==0
		PlayerObjectCollision(C_TOUCH,-16,0,16,32)
		if CheckResult==1
			Object.Value0=4
			Object.State=1
			Object.DrawOrder=4
			Object.Frame=0
		endif
	endif
endsub


sub ObjectDraw
	switch Object.State
	case 1
		if Object.Value0>0
			Object.Value0--
		else
			Object.State=2
			PlayStageSfx(3,0)
		endif
		break
	case 2
		DrawSprite(Object.Frame)
		Object.Value0++
		if Object.Value0>4
			Object.Value0=0
			Object.Frame++
			if Object.Frame>4
				Object.State=0
			endif
		endif
		break

	endswitch
endsub


sub ObjectStartup
	LoadSpriteSheet("R1/Objects3.gif")
	SpriteFrame(-16,-16,32,16,166,51)
	SpriteFrame(-16,-64,32,64,148,101)
	SpriteFrame(-16,-48,32,48,115,101)
	SpriteFrame(-16,-32,32,32,107,68)
	SpriteFrame(-16,-32,32,32,140,68)
endsub

sub RSDK
	LoadSpriteSheet("Global/Display.gif")
	SetEditorIcon(Icon0,SingleIcon,-16,-16,32,32,1,143)
endsub
